/**
 * SoundFileChooser.java
 * @author Daniel Liu
 * Create: 2006-12-23 ����01:51:49
 */
package org.lex.ftp.ui.prefs;

import java.awt.Dimension;
import java.io.File;

import javax.swing.JFileChooser;

import org.lex.io.filesystem.PostfixFileFilter;


public class SoundFileChooser {
	private SoundFileChooser() {
	}

	private static PostfixFileFilter soundFileFilter = null;

	static {
		soundFileFilter = new PostfixFileFilter();
		soundFileFilter.setDescription("Sound Files");
		soundFileFilter.addExtension("au", "wav", "aiff");
	}

	public static JFileChooser newFileChooser(File dir) {
		JFileChooser fc = new JFileChooser();
		fc.setCurrentDirectory(dir);
		fc.addChoosableFileFilter(soundFileFilter);
		fc.setAcceptAllFileFilterUsed(false);
		fc.setFileFilter(soundFileFilter);
		fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
		SoundPreviewPane pane = new SoundPreviewPane(fc);
		fc.setAccessory(pane);
		pane.setPreferredSize(new Dimension(200, 100));
		fc.setPreferredSize(new Dimension(500, 375));
		return fc;
	}
}
